package com.fansaikj.crm.domain;

import xyz.erupt.annotation.*;
import xyz.erupt.annotation.sub_erupt.*;
import xyz.erupt.annotation.sub_field.*;
import xyz.erupt.annotation.sub_field.sub_edit.*;
import xyz.erupt.upms.model.base.HyperModel;
import xyz.erupt.jpa.model.BaseModel;
import java.util.*;
import java.util.Date;
import javax.persistence.*;
import org.hibernate.annotations.GenericGenerator;

@Erupt(
    name = "开票申请表",
    power = @Power(importable = true, export = true)
)
@Table(name = "crm_invoice_apply")   //数据库表名
@Entity
public class CrmInvoiceApply{


    @Id
    @GeneratedValue(generator="generator")
    @GenericGenerator(name="generator", strategy="native")
    @Column(nullable = false)
    @EruptField()
    private Long id;
    
    @ManyToOne
    @JoinColumn(name = "contractId")
    @EruptField(
        views = @View(
            title = "关联合同ID",
            column = "contractCode",
            width = "120"
        ),
        edit = @Edit(
            title = "关联合同ID",
            notNull = true,
            type = EditType.REFERENCE_TABLE,
            referenceTableType = @ReferenceTableType(label = "contractCode"),
            search = @Search
        )
    )
    private CrmContract crmContract;
    
    @ManyToOne
    @JoinColumn(name = "customerId")
    @EruptField(
        views = @View(
            title = "关联客户ID",
            column = "customerName",
            width = "120"
        ),
        edit = @Edit(
            title = "关联客户ID",
            notNull = true,
            type = EditType.REFERENCE_TABLE,
            referenceTableType = @ReferenceTableType(label = "customerName"),
            search = @Search
        )
    )
    private CrmCustomer crmCustomer;
    
    @Column(precision = 15, scale = 2, nullable = false)
    @EruptField(
        views = @View(
            title = "开票金额",
            width = "120"
        ),
        edit = @Edit(
            title = "开票金额",
            notNull = true,
            search = @Search
        )
    )
    private Float invoiceAmount;
    
    @Column(length = 20, nullable = false)
    @EruptField(
        views = @View(
            title = "发票类型",
            width = "120"
        ),
        edit = @Edit(
            title = "发票类型",
            notNull = true,
            search = @Search
        )
    )
    private String invoiceType;
    
    @Column(nullable = false)
    @EruptField(
        views = @View(
            title = "申请日期",
            width = "120"
        ),
        edit = @Edit(
            title = "申请日期",
            notNull = true,
            type = EditType.DATE,
            dateType = @DateType(type = DateType.Type.DATE)
        )
    )
    private Date applyDate;
    
    @Column(length = 100, nullable = false)
    @EruptField(
        views = @View(
            title = "发票抬头",
            width = "120"
        ),
        edit = @Edit(
            title = "发票抬头",
            notNull = true
        )
    )
    private String invoiceTitle;
    
    @Column(length = 50, nullable = false)
    @EruptField(
        views = @View(
            title = "税号",
            width = "120"
        ),
        edit = @Edit(
            title = "税号",
            notNull = true
        )
    )
    private String taxNumber;
    
    @Column(length = 100)
    @EruptField(
        views = @View(
            title = "银行账户",
            width = "120"
        ),
        edit = @Edit(
            title = "银行账户"
        )
    )
    private String bankAccount;
    
    @Column(length = 20, nullable = false)
    @EruptField(
        views = @View(
            title = "开票状态",
            width = "120"
        ),
        edit = @Edit(
            title = "开票状态",
            notNull = true
        )
    )
    private String invoiceStatus;
    
    @Column(length = 50, nullable = false)
    @EruptField(
        views = @View(
            title = "create_by",
            width = "120"
        ),
        edit = @Edit(
            title = "create_by",
            notNull = true
        )
    )
    private String createBy;
    
    @Column(nullable = false)
    @EruptField(
        views = @View(
            title = "create_time",
            width = "120"
        ),
        edit = @Edit(
            title = "create_time",
            notNull = true,
            type = EditType.DATE,
            dateType = @DateType(type = DateType.Type.DATE)
        )
    )
    private Date createTime;
    
    @Column(length = 50)
    @EruptField(
        views = @View(
            title = "update_by",
            width = "120"
        ),
        edit = @Edit(
            title = "update_by"
        )
    )
    private String updateBy;
    
    @EruptField(
        views = @View(
            title = "update_time",
            width = "120"
        ),
        edit = @Edit(
            title = "update_time",
            type = EditType.DATE,
            dateType = @DateType(type = DateType.Type.DATE)
        )
    )
    private Date updateTime;
    
    @Column(length = 255)
    @EruptField(
        views = @View(
            title = "remark",
            width = "120"
        ),
        edit = @Edit(
            title = "remark"
        )
    )
    private String remark;
    

}
